package com.dd.model;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

public class PublicSupervisionData {
    private String id;
    private String specificAddress;
    private String problemType;
    private String submitDate;
    private String status;
    private String severity;
    private String problemDescription;
    private String assignedWorkerId;   // 存储网格员ID
    private String assignedGridWorker; // 存储网格员姓名 (从 assignedWorkerName 重命名)
    private String province;
    private String city;
    private String estimatedAqi;
    private String feedbackerName;
    private String feedbackerGender; // 反馈者性别
    private String feedbackerPhone;  // 反馈者联系电话

    // 无参构造函数，Gson需要
    public PublicSupervisionData() {
    }

    // 完整的构造方法
    public PublicSupervisionData(String id, String submitDate, String specificAddress, String province, String city,
                                 String problemType, String severity, String problemDescription, String status,
                                 String assignedWorkerId, String assignedGridWorker, String estimatedAqi, String feedbackerName,
                                 String feedbackerGender, String feedbackerPhone) {
        this.id = id;
        this.submitDate = submitDate;
        this.specificAddress = specificAddress;
        this.province = province;
        this.city = city;
        this.problemType = problemType;
        this.severity = severity;
        this.problemDescription = problemDescription;
        this.status = status;
        this.assignedWorkerId = assignedWorkerId;
        this.assignedGridWorker = assignedGridWorker;
        this.estimatedAqi = estimatedAqi;
        this.feedbackerName = feedbackerName;
        this.feedbackerGender = feedbackerGender;
        this.feedbackerPhone = feedbackerPhone;
    }

    // 简化构造方法，用于初始化部分数据，其他字段可按需通过setter设置
    public PublicSupervisionData(String id, String specificAddress, String problemType, String submitDate,
                                 String status, String severity, String problemDescription,
                                 String assignedWorkerId, String assignedGridWorker) {
        this(id, submitDate, specificAddress, "", "", problemType, severity, problemDescription, status, assignedWorkerId, assignedGridWorker, "", "", "", "");
    }


    // Getters for plain String fields (for Gson and general data access)
    public String getId() { return id; }
    public String getSubmitDate() { return submitDate; }
    public String getSpecificAddress() { return specificAddress; }
    public String getProvince() { return province; }
    public String getCity() { return city; }
    public String getProblemType() { return problemType; }
    public String getSeverity() { return severity; }
    public String getProblemDescription() { return problemDescription; }
    public String getStatus() { return status; }
    public String getAssignedWorkerId() { return assignedWorkerId; }
    public String getAssignedGridWorker() { return assignedGridWorker; } // 现在直接使用 assignedGridWorker 字段
    public String getEstimatedAqi() { return estimatedAqi; }
    public String getFeedbackerName() { return feedbackerName; }
    public String getFeedbackerGender() { return feedbackerGender; }
    public String getFeedbackerPhone() { return feedbackerPhone; }

    // Setters for plain String fields
    public void setId(String id) { this.id = id; }
    public void setSubmitDate(String submitDate) { this.submitDate = submitDate; }
    public void setSpecificAddress(String specificAddress) { this.specificAddress = specificAddress; }
    public void setProvince(String province) { this.province = province; }
    public void setCity(String city) { this.city = city; }
    public void setProblemType(String problemType) { this.problemType = problemType; }
    public void setSeverity(String severity) { this.severity = severity; }
    public void setProblemDescription(String problemDescription) { this.problemDescription = problemDescription; }
    public void setStatus(String status) { this.status = status; }
    public void setAssignedWorkerId(String assignedWorkerId) { this.assignedWorkerId = assignedWorkerId; }
    public void setAssignedGridWorker(String assignedGridWorker) { this.assignedGridWorker = assignedGridWorker; } // 现在直接使用 assignedGridWorker 字段
    public void setEstimatedAqi(String estimatedAqi) { this.estimatedAqi = estimatedAqi; }
    public void setFeedbackerName(String feedbackerName) { this.feedbackerName = feedbackerName; }
    public void setFeedbackerGender(String feedbackerGender) { this.feedbackerGender = feedbackerGender; }
    public void setFeedbackerPhone(String feedbackerPhone) { this.feedbackerPhone = feedbackerPhone; }

    // JavaFX Properties for TableView/UI binding
    public StringProperty idProperty() { return new SimpleStringProperty(id); }
    public StringProperty submitDateProperty() { return new SimpleStringProperty(submitDate); }
    public StringProperty specificAddressProperty() { return new SimpleStringProperty(specificAddress); }
    public StringProperty provinceProperty() { return new SimpleStringProperty(province); }
    public StringProperty cityProperty() { return new SimpleStringProperty(city); }
    public StringProperty problemTypeProperty() { return new SimpleStringProperty(problemType); }
    public StringProperty severityProperty() { return new SimpleStringProperty(severity); }
    public StringProperty problemDescriptionProperty() { return new SimpleStringProperty(problemDescription); }
    public StringProperty statusProperty() { return new SimpleStringProperty(status); }
    public StringProperty assignedGridWorkerProperty() { return new SimpleStringProperty(assignedGridWorker); } // 重命名并使用 assignedGridWorker 字段
    public StringProperty estimatedAqiProperty() { return new SimpleStringProperty(estimatedAqi); }
    public StringProperty feedbackerNameProperty() { return new SimpleStringProperty(feedbackerName); }
    public StringProperty feedbackerGenderProperty() { return new SimpleStringProperty(feedbackerGender); }
    public StringProperty feedbackerPhoneProperty() { return new SimpleStringProperty(feedbackerPhone); }

    @Override
    public String toString() {
        return "PublicSupervisionData{" +
                "id='" + id + '\'' +
                ", specificAddress='" + specificAddress + '\'' +
                ", problemType='" + problemType + '\'' +
                ", submitDate='" + submitDate + '\'' +
                ", status='" + status + '\'' +
                ", severity='" + severity + '\'' +
                ", problemDescription='" + problemDescription + '\'' +
                ", assignedWorkerId='" + assignedWorkerId + '\'' +
                ", assignedGridWorker='" + assignedGridWorker + '\'' + // 更新字段名
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", estimatedAqi='" + estimatedAqi + '\'' +
                ", feedbackerName='" + feedbackerName + '\'' +
                ", feedbackerGender='" + feedbackerGender + '\'' +
                ", feedbackerPhone='" + feedbackerPhone + '\'' +
                '}';
    }
}
